<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
</html>
<script>
    class Person{
        constructor(name,age){
            // 是属性
            this.name = name;
            this.age = age;
        }
        hobby(){
            console.log("打篮球");
        }
    }

    console.log(typeof Person);

    let zhangsan = new Person("张三",20);
    let lisi = new Person("李四",20);

    console.log(zhangsan);

    zhangsan.hobby();
    lisi.hobby();



    // 例题
    class Dog{
        constructor(name,gender){
            this.name = name;
            this.gender = gender;
        }
        wow(){
            console.log(this.name + ":wowowowowow!!!");
        }
    }

    let dahaung = new Dog("大黄","公");
    dahaung.wow();

    let xiaohei  = new Dog("小黑","公");

    setInterval(() => {
        xiaohei.wow();
    }, 2000);






</script>